function searchFormSubmit(f){
	var el = new Array();
	
	for(var i=0; i<f.elements.length; i++){
		el[i] = f.elements[i].name + '=' +  encodeURI(f.elements[i].value);
	}
	var par = el.join('&');
	var base_url = f.action;
	var q = -1 == base_url.indexOf('?') ? "?" : "&";
	window.location.href = f.action +q+par;
	return false;
}


//将给定的url分解，并且，返回的source会去掉query里的重复部分
function parseURL(url) {
    var a = document.createElement('a');
    a.href = url;
   var ret = {
        scheme : a.protocol.replace(':',''),
        host: a.hostname,
        port: a.port,
        query: a.search,
        params: (function(){
            var ret = {},
                seg = a.search.replace(/^\?/,'').split('&'),
                len = seg.length, i = 0, s;
            for (;i<len;i++) {
                if (!seg[i]) { continue; }
                s = seg[i].split('=');
                ret[s[0]] = s[1];
            }
            return ret;
        })(),
        file: (a.pathname.match(/\/([^\/?#]+)$/i) || [,''])[1],
        fragment: a.hash.replace('#',''),
        path: a.pathname.replace(/^([^\/])/,'/$1'),
        relative: (a.href.match(/tp:\/\/[^\/]+(.+)/) || [,''])[1],
        segments: a.pathname.replace(/^\//,'').split('/')
    };
	
	var query = '';
	var i=0;
	for(var k in ret.params){
		query += i==0 ? '?' +k + '=' + ret.params[k] :  '&' +k + '=' + ret.params[k] 
		i++;
	}
	a.search = query;
	ret.source = a.href;
	
	return ret;
}